<?php

define('THIS', 'Diagnostics');
class Diagnostics
{
	public $load;
	
	function main()
	{
		$this->load->display->item2('Swixs Version', SWIXSVERSION . ' (Build ' . SWIXSBUILD . ')');
		$this->load->display->item2('Operating System', $this->load->get_os());
		$this->load->display->item2('PHP Version', PHP_VERSION . ' (' . PHP_SAPI . ')');
		$this->load->display->item2('MySQL Version', SQL::version());
		$this->load->display->item2('HTMLPurifier Version', $this->load->htmlpurifier->version);
		$this->load->display->item2('Server Load', $this->load->get_server_load() . ' %');
		$extensions = get_loaded_extensions();
		sort($extensions);
		echo '<br /><br /><h2>PHP Environment</h2>';
		$this->load->display->item2('Safe Mode', ((bool)ini_get('safe_mode') ? '<span style="color: #FF0000;font-weight: 700;">Enabled</span>' : '<span style="color: #087400;font-weight: 700;">Disabled</span>'));
		$this->load->display->item2('Register Globals', ((bool)ini_get('register_globals') ? '<span style="color: #FF0000;font-weight: 700;">Enabled</span>' : '<span style="color: #087400;font-weight: 700;">Disabled</span>'));
		$this->load->display->item2('GD Library', (extension_loaded('gd') ? '<span style="color: #087400;font-weight: 700;">Loaded</span>' : '<span style="color: #FF0000;font-weight: 700;">Not Found</span>'));
		$this->load->display->item2('<em>mbstring</em>', (extension_loaded('mbstring') ? '<span style="color: #087400;font-weight: 700;">Loaded</span>' : '<span style="color: #FF0000;font-weight: 700;">Not Found</span>'));
		$this->load->display->item2('<em>allow_url_fopen</em>', ((bool)ini_get('allow_url_fopen') ? '<span style="color: #087400;font-weight: 700;">Enabled</span>' : '<span style="color: #FF0000;font-weight: 700;">Disabled</span>'));
		$this->load->display->item2('<em>mbstring.func_overload</em>', ((bool)ini_get('mbstring.func_overload') ? '<span style="color: #FF0000;font-weight: 700;">On</span>' : '<span style="color: #087400;font-weight: 700;">Off</span>'));
		$this->load->display->item2('<em>open_basedir</em>', '<span style="color: #0000FF;font-weight: 700;">' . (trim(ini_get('open_basedir')) == '' ? 'Undefined' : ini_get('open_basedir')) . '</span>');
		$this->load->display->item2('Loaded Extensions', implode(', ', $extensions));
	}
}
?>